// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.designer.ui.process.models;

import org.dengues.core.process.CompElement;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.swt.SWT;

/**
 * qzhang class global comment. Detailled comment <br/>
 */
public class CompBlock extends CompElement {

    private CompProcess compProcess;

    private Dimension size = new Dimension(0, 0);

    private Point location = new Point(0, 0);

    private String name;

    private int color = SWT.COLOR_GRAY;

    public static final String PROP_BLOCK_SIZE = "CompBlock_size"; //$NON-NLS-1$

    public static final String PROP_BLOCK_COLOR = "CompBlock_color"; //$NON-NLS-1$

    public static final String PROP_BLOCK_LOCATION = "CompBlock_location"; //$NON-NLS-1$

    public static final String PROP_BLOCK_NAME = "CompBlock_name"; //$NON-NLS-1$

    /**
     * qzhang CompBlock constructor comment.
     * 
     * @param component
     */
    public CompBlock() {

    }

    /**
     * 
     */
    private static final long serialVersionUID = 1645645764574443L;

    /*
     * (non-Javadoc)
     * 
     * @see org.dengues.designer.ui.gef.models.Element#getElementName()
     */
    @Override
    public String getCompName() {
        return "Block";
    }

    /**
     * Getter for color.
     * 
     * @return the color
     */
    public int getColor() {
        return this.color;
    }

    /**
     * Sets the color.
     * 
     * @param color the color to set
     */
    public void setColor(int color) {
        this.color = color;
        fireStructureChange(PROP_BLOCK_COLOR, this.color);
    }

    /**
     * Getter for compProcess.
     * 
     * @return the compProcess
     */
    @Override
    public CompProcess getCompProcess() {
        return this.compProcess;
    }

    /**
     * Sets the compProcess.
     * 
     * @param compProcess the compProcess to set
     */
    public void setCompProcess(CompProcess compProcess) {
        this.compProcess = compProcess;
    }

    /**
     * Getter for size.
     * 
     * @return the size
     */
    @Override
    public Dimension getSize() {
        return this.size;
    }

    /**
     * Sets the size.
     * 
     * @param size the size to set
     */
    public void setSize(Dimension size) {
        this.size = size;
        fireStructureChange(PROP_BLOCK_SIZE, this.size);
    }

    /**
     * Getter for location.
     * 
     * @return the location
     */
    @Override
    public Point getLocation() {
        return this.location;
    }

    /**
     * Sets the location.
     * 
     * @param location the location to set
     */
    public void setLocation(Point location) {
        this.location = location;
        fireStructureChange(PROP_BLOCK_LOCATION, this.location);
    }

    /**
     * Getter for name.
     * 
     * @return the name
     */
    public String getName() {
        return this.name;
    }

    /**
     * Sets the name.
     * 
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
        fireStructureChange(PROP_BLOCK_NAME, this.name);
    }

}
